package com.lshlmy.kafka;

import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.support.Acknowledgment;
import org.springframework.stereotype.Component;

/**
 * @author liangxiangming
 * @date 2022/08/31
 **/
@Slf4j
@Component
public class KafkaConsumer {

    @KafkaListener(topics = "test", groupId = "zhTestGroup")
    public void listenZhugeGroup(ConsumerRecord<String, String> record, Acknowledgment ack) {
        log.info("key:{},value:{}", record.key(), record.value());
        ack.acknowledge();
    }
}